#include <iostream>
#include <cstring>

using namespace std;

char* mystrcpy(char *des, const char *src)
{
    char *pd = des;
    char *ps = (char *)src;
    while(*ps != 0)
    {
        *(pd++) = *(ps++);
    }
    *pd = 0;
    return des;
}

char* mystrncpy(char *des, const char *src, const size_t n)
{
    memcpy(des, src, n);
    *(des+n) = 0;
    return des;
}

int main(void)
{
    char str[31];
    /* test mystrcpy */
    // memset(str, 0, sizeof(str));
    // mystrcpy(str, "Chicken");
    /* test mystrncpy */
    mystrncpy(str, "Chicken", 3);
    cout << str << endl;
    return 0;
}
